package com.etc.delivery.service.admin.impl;

import com.etc.delivery.dao.admin.AdminWaybillDao;
import com.etc.delivery.dto.WaybillDto;
import com.etc.delivery.entity.MailType;
import com.etc.delivery.entity.Waybill;
import com.etc.delivery.service.admin.IAdminWaybillService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AdminWaybillServiceImpl implements IAdminWaybillService {

    @Resource
    private AdminWaybillDao waybillDao;

    @Override
    public PageInfo<WaybillDto> queryWaybill(String waybillNo, Integer mailType, Integer warehouseId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<WaybillDto> list = waybillDao.queryWaybill(waybillNo, mailType, warehouseId);
        PageInfo pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public boolean deleteWaybill(String waybillNo) {
        return waybillDao.deleteWaybill(waybillNo);
    }

    @Override
    public boolean updateWaybill(Waybill waybill) {
        return waybillDao.updateWaybill(waybill);
    }

    @Override
    public List<MailType> queryMailName() {
        return waybillDao.queryMailName();
    }
}
